<template>
    <div class='application-container'>
        <!-- <MainLayout>
           <router-view/> 
        </MainLayout> -->
        <!-- <NullLayout>
            <router-view/>
        </NullLayout> -->
        <component :is='commonName'>
            <router-view></router-view>
        </component>
    </div>
</template>

<script>
export default {
    // data(){
    //     return{
    //         commonName:''
    //     }
    // },
    watch:{
        menus(val){
            let menuList=val.filter(it=>!!it.path)
            let routes=menuList.map(it=>{
                return {path:it.path,component:(()=>import('.'+it.path))}
            })
            // console.log(this.$router)
            this.$router.addRoutes(routes)
        }
    },
    computed:{
        commonName(){
            // return 'MainLayout' : 'NullLayout'
            // debugger
            // console.log(this.$route.meta.layout)
            return this.$route.meta.layout || 'MainLayout'
        },
        menus(){
            return this.$store.getters['common/menuList']
        }
    }
}
</script>